package com.dys.config;

import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import java.util.Properties;

/**
 * @className: com.dys.config.GlobalException2
 * @description: 全局异常
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/11/01 21:39
 */
// @Configuration
public class GlobalException2 {

    @Bean
    public SimpleMappingExceptionResolver getSimpleMappingExceptionResolver() {
        SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver();
        Properties prop = new Properties();
        prop.put("java.lang.NullPointerException", "err3.jsp");
        prop.put("java.lang.ArithmeticException", "err2.jsp");
        resolver.setExceptionMappings(prop);

        return resolver;
    }
}
